Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.hw
Class Expression_Operation

    java.lang.Object
      rdlc.hw.Expression_Operation

All Implemented Interfaces:
  Expression

    public class Expression_Operation

extends java.lang.Object
implements Expression

Encodes an expression which requires actual computation in hardware. Many of the operations are hardware specific, of course.

Version:
  $Revision: 1.8 $
Author:
  Greg Gibeling

Field Summary
`protected java.util.List<Expression>` | `arguments` A list of the arguments to the given operation.
`protected boolean` | `constant` Is the result of this operation a constant? This is automatically determined by the arguments which are added to this expression.
`static boolean[]` | `OP_ASSOC` Associativity of the operators.
`static int` | `OP_BITAND` Constant denoting bitwise and of the arguments.
`static int` | `OP_BITANDALL` Constant denoting bitwise and of all the bits in all the arguments.
`static int` | `OP_BITNOT` Constant denoting the inversion of each bit in the input.
`static int` | `OP_BITOR` Constant denoting bitwise or of the arguments.
`static int` | `OP_BITORALL` Constant denoting bitwise or of all the bits in all the arguments.
`static int` | `OP_BITSELECT` Constant denoting bit selection.
`static int` | `OP_BITXOR` Constant denoting bitwise xor of the arguments.
`static int` | `OP_BITXORALL` Constant denoting bitwise xor of all the bits in all the arguments.
`static int` | `OP_CONCATENATE` Constant denoting concatenation of bit lists.
`static int` | `OP_EQ` Constant denoting an equality test.
`static java.lang.String[]` | `OP_INFIX` Infix operators.
`static int` | `OP_INVALID` Constant denoting an invalid operation.
`static int` | `OP_MAX` Constant denoting maximum of two arguments.
`static int` | `OP_MIN` Constant denoting minimum of two arguments.
`static int` | `OP_MINUS` Constant denoting subtraction of the arguments.
`static java.lang.String[]` | `OP_NAME` Give names to all of the operations for debugging.
`static int` | `OP_NEQ` Constant denoting an inequality test.
`static int` | `OP_PLUS` Constant denoting addition of the arguments.
`static int` | `OP_REPLICATE` Constant denoting bit list replication and concatenation.
`static int` | `OP_SHIFTLEFT` Constant denoting logical shift left.
`static int` | `OP_SHIFTRIGHT` Constant denoting logical shift right.
`protected int` | `operation` The operation this expression is performing.

Constructor Summary
`Expression_Operation(Expression_Operation _source)` Copy constructor.
`Expression_Operation(int _operation)` Simple constructor.
`Expression_Operation(int _operation, Expression _arg0)` Simple constructor.
`Expression_Operation(int _operation, Expression _arg0, Expression _arg1)` Simple constructor.
`Expression_Operation(int _operation, Expression _arg0, Expression _arg1, Expression _arg2)` Simple constructor.
`Expression_Operation(int _operation, ModuleWireGroup wireGroup)` Constructor for bit list operations.

Method Summary
`void` | `addArgument(Expression _arg)` Add an argument to this expression.
`static Expression_Operation` | `and(Expression arg1, Expression arg2)` Create an expression representing a bitwise and.
`static Expression_Operation` | `and(Expression arg1, Expression arg2, Expression arg3)` Create an expression representing a bitwise and.
`static Expression_Operation` | `concatenate(Expression arg1, Expression arg2)` Create an expression representing a bit list concatentation.
`static Expression_Operation` | `concatenate(Expression arg1, Expression arg2, Expression arg3)` Create an expression representing a bit list concatentation.
`protected java.lang.String` | `concatenateString(boolean skipFirst)` Simple accessor.
`Expression` | `getArgument(int index)` Simple accessor.
`int` | `getNArguments()` Simple accessor.
`int` | `getOperation()` Simple accessor.
`boolean` | `isConstant()` Simple accessor.
`boolean` | `isLValue()` Simple accessor.
`boolean` | `isRValue()` Simple accessor.
`static Expression_Operation` | `minus(Expression arg1, Expression arg2)` Create an expression representing a subtraction.
`static Expression_Operation` | `not(Expression arg)` Create an expression representing a bitwise not.
`static Expression_Operation` | `or(Expression arg1, Expression arg2)` Create an expression representing a bitwise or.
`static Expression_Operation` | `or(Expression arg1, Expression arg2, Expression arg3)` Create an expression representing a bitwise or.
`static Expression_Operation` | `plus(Expression arg1, Expression arg2)` Create an expression representing an addition.
`static Expression_Operation` | `replicate(int count, Expression arg2)` Create an expression representing a bit list replication.
`static Expression_Operation` | `select(Expression bus, int max, int min)` Create an expression representing a bit selection.
`static Expression_Operation` | `shiftLeft(Expression value, Expression shAmt)` Create an expression representing a logical shift left.
`static Expression_Operation` | `shiftRight(Expression value, Expression shAmt)` Create an expression representing a logical shift right.
`java.lang.String` | `toString()` Simple accessor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### OP_BITNOT

    public static final int OP_BITNOT

  Constant denoting the inversion of each bit in the input.

  See Also:
    Constant Field Values

### OP_BITSELECT

    public static final int OP_BITSELECT

  Constant denoting bit selection.

  See Also:
    Constant Field Values

### OP_SHIFTRIGHT

    public static final int OP_SHIFTRIGHT

  Constant denoting logical shift right.

  See Also:
    Constant Field Values

### OP_SHIFTLEFT

    public static final int OP_SHIFTLEFT

  Constant denoting logical shift left.

  See Also:
    Constant Field Values

### OP_BITAND

    public static final int OP_BITAND

  Constant denoting bitwise and of the arguments.

  See Also:
    Constant Field Values

### OP_BITOR

    public static final int OP_BITOR

  Constant denoting bitwise or of the arguments.

  See Also:
    Constant Field Values

### OP_BITXOR

    public static final int OP_BITXOR

  Constant denoting bitwise xor of the arguments.

  See Also:
    Constant Field Values

### OP_PLUS

    public static final int OP_PLUS

  Constant denoting addition of the arguments.

  See Also:
    Constant Field Values

### OP_MINUS

    public static final int OP_MINUS

  Constant denoting subtraction of the arguments.

  See Also:
    Constant Field Values

### OP_CONCATENATE

    public static final int OP_CONCATENATE

  Constant denoting concatenation of bit lists.

  See Also:
    Constant Field Values

### OP_MAX

    public static final int OP_MAX

  Constant denoting maximum of two arguments.

  See Also:
    Constant Field Values

### OP_MIN

    public static final int OP_MIN

  Constant denoting minimum of two arguments.

  See Also:
    Constant Field Values

### OP_BITANDALL

    public static final int OP_BITANDALL

  Constant denoting bitwise and of all the bits in all the arguments.

  See Also:
    Constant Field Values

### OP_BITORALL

    public static final int OP_BITORALL

  Constant denoting bitwise or of all the bits in all the arguments.

  See Also:
    Constant Field Values

### OP_BITXORALL

    public static final int OP_BITXORALL

  Constant denoting bitwise xor of all the bits in all the arguments.

  See Also:
    Constant Field Values

### OP_EQ

    public static final int OP_EQ

  Constant denoting an equality test.

  See Also:
    Constant Field Values

### OP_NEQ

    public static final int OP_NEQ

  Constant denoting an inequality test.

  See Also:
    Constant Field Values

### OP_REPLICATE

    public static final int OP_REPLICATE

  Constant denoting bit list replication and concatenation.

  See Also:
    Constant Field Values

### OP_INVALID

    public static final int OP_INVALID

  Constant denoting an invalid operation.

  See Also:
    Constant Field Values

### OP_NAME

    public static final java.lang.String[] OP_NAME

  Give names to all of the operations for debugging.

### OP_INFIX

    public static final java.lang.String[] OP_INFIX

  Infix operators. An empty string means a non-infix operator.

### OP_ASSOC

    public static final boolean[] OP_ASSOC

  Associativity of the operators. Associative operations can be merged and flattened (parentheses removed).

### constant

    protected boolean constant

  Is the result of this operation a constant? This is automatically determined by the arguments which are added to this expression.

### operation

    protected int operation

  The operation this expression is performing.

### arguments

    protected java.util.List<Expression> arguments

  A list of the arguments to the given operation.

Constructor Detail

### Expression_Operation

    public Expression_Operation(int _operation)

  Simple constructor. Stores and validates the operation. Assumes arguments will be added later.

  Parameters:
    `_operation` - The operation.
  See Also:
    `addArgument(Expression)`

### Expression_Operation

    public Expression_Operation(int _operation,
                                Expression _arg0)

  Simple constructor. Stores and validates the operation and one argument. More arguments may be added later.

  Parameters:
    `_operation` - The operation.
    `_arg0` - The first argument.

### Expression_Operation

    public Expression_Operation(int _operation,
                                Expression _arg0,
                                Expression _arg1)

  Simple constructor. Stores and validates the operation and two arguments. More arguments may be added later.

  Parameters:
    `_operation` - The operation.
    `_arg0` - The first argument.
    `_arg1` - The second argument.

### Expression_Operation

    public Expression_Operation(int _operation,
                                Expression _arg0,
                                Expression _arg1,
                                Expression _arg2)

  Simple constructor. Stores and validates the operation and three arguments. More arguments may be added later.

  Parameters:
    `_operation` - The operation.
    `_arg0` - The first argument.
    `_arg1` - The second argument.
    `_arg2` - The third argument.

### Expression_Operation

    public Expression_Operation(int _operation,
                                ModuleWireGroup wireGroup)

  Constructor for bit list operations. This is useful when attempting to e.g. add all the bits in a wire group together, or simply concatenate them.

  Parameters:
    `_operation` - The operation.
    `wireGroup` - The wire group. All wires in it will be added as arguments to this expression.

### Expression_Operation

    public Expression_Operation(Expression_Operation _source)

  Copy constructor.

  Parameters:
    `_source` - The expression to copy.

Method Detail

### isConstant

    public boolean isConstant()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isConstant` in interface `Expression`
  Returns:
    `true` if this expression evaluates to a constant.
  See Also:
    `Expression.isConstant()`

### isLValue

    public boolean isLValue()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isLValue` in interface `Expression`
  Returns:
    `true` if this expression can appear on the left of an assignment.
  See Also:
    `Expression.isLValue()`

### isRValue

    public boolean isRValue()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isRValue` in interface `Expression`
  Returns:
    `true` if this expression can appear on the right of an assignment.
  See Also:
    `Expression.isRValue()`

### addArgument

    public void addArgument(Expression _arg)

  Add an argument to this expression. Not only will this check and update the constant flag for this expression, but if the new argument is an identical operation and the operation is associative it will merge the two expressions.

  Parameters:
    `_arg` - The argument to add to this expression.

### getOperation

    public int getOperation()

  Simple accessor.

  Returns:
    The operation performed by this expression.

### getNArguments

    public int getNArguments()

  Simple accessor.

  Returns:
    The number of arguments to this expression.

### getArgument

    public Expression getArgument(int index)

  Simple accessor.

  Parameters:
    `index` - The index of the argument to return.
  Returns:
    The argument expression at the given index.

### toString

    public java.lang.String toString()

  Simple accessor.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A human readable representation of this expression for debugging.

### concatenateString

    protected java.lang.String concatenateString(boolean skipFirst)

  Simple accessor.

  Returns:
    A string representing the concatenation of all the arguments to this expression.

### not

    public static Expression_Operation not(Expression arg)

  Create an expression representing a bitwise not.

  Parameters:
    `arg` - The expression to invert.
  Returns:
    An expression representing a bitwise not.

### select

    public static Expression_Operation select(Expression bus,
                                              int max,
                                              int min)

  Create an expression representing a bit selection.

  Parameters:
    `bus` - The bus or bit list to select from.
    `max` - The maximum bit to select.
    `min` - The minimum bit to select.
  Returns:
    An expression representing a bit selection.

### shiftRight

    public static Expression_Operation shiftRight(Expression value,
                                                  Expression shAmt)

  Create an expression representing a logical shift right.

  Parameters:
    `value` - The value to shift.
    `shAmt` - The amount to shift it by. If this is not a constant the shift will be EXPENSIVE in hardware.
  Returns:
    An expression representing a logical shift right.

### shiftLeft

    public static Expression_Operation shiftLeft(Expression value,
                                                 Expression shAmt)

  Create an expression representing a logical shift left.

  Parameters:
    `value` - The value to shift.
    `shAmt` - The amount to shift it by. If this is not a constant the shift will be EXPENSIVE in hardware.
  Returns:
    An expression representing a logical shift left.

### and

    public static Expression_Operation and(Expression arg1,
                                           Expression arg2)

  Create an expression representing a bitwise and.

  Parameters:
    `arg1` - The first argument to and.
    `arg2` - The second argument to and.
  Returns:
    An expression representing a bitwise and.

### and

    public static Expression_Operation and(Expression arg1,
                                           Expression arg2,
                                           Expression arg3)

  Create an expression representing a bitwise and.

  Parameters:
    `arg1` - The first argument to and.
    `arg2` - The second argument to and.
    `arg3` - The third argument to and.
  Returns:
    An expression representing a bitwise and.

### or

    public static Expression_Operation or(Expression arg1,
                                          Expression arg2)

  Create an expression representing a bitwise or.

  Parameters:
    `arg1` - The first argument to or.
    `arg2` - The second argument to or.
  Returns:
    An expression representing a bitwise or.

### or

    public static Expression_Operation or(Expression arg1,
                                          Expression arg2,
                                          Expression arg3)

  Create an expression representing a bitwise or.

  Parameters:
    `arg1` - The first argument to or.
    `arg2` - The second argument to or.
    `arg3` - The third argument to or.
  Returns:
    An expression representing a bitwise or.

### concatenate

    public static Expression_Operation concatenate(Expression arg1,
                                                   Expression arg2)

  Create an expression representing a bit list concatentation.

  Parameters:
    `arg1` - The first argument to concatenate.
    `arg2` - The second argument to concatenate.
  Returns:
    An expression representing a bit list concatentation.

### concatenate

    public static Expression_Operation concatenate(Expression arg1,
                                                   Expression arg2,
                                                   Expression arg3)

  Create an expression representing a bit list concatentation.

  Parameters:
    `arg1` - The first argument to concatenate.
    `arg2` - The second argument to concatenate.
    `arg3` - The third argument to concatenate.
  Returns:
    An expression representing a bit list concatentation.

### replicate

    public static Expression_Operation replicate(int count,
                                                 Expression arg2)

  Create an expression representing a bit list replication.

  Parameters:
    `count` - The number of times to replicate the second argument.
    `arg2` - The bit list to replicate.
  Returns:
    An expression representing a bit list replication.

### plus

    public static Expression_Operation plus(Expression arg1,
                                            Expression arg2)

  Create an expression representing an addition.

  Parameters:
    `arg1` - The first argument to add.
    `arg2` - The second argument to add.
  Returns:
    An expression representing an addition.

### minus

    public static Expression_Operation minus(Expression arg1,
                                             Expression arg2)

  Create an expression representing a subtraction.

  Parameters:
    `arg1` - The first argument to subtract.
    `arg2` - The second argument to subtract.
  Returns:
    An expression representing a subtraction.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD